package yxk.task;

import kd.bos.context.RequestContext;
import kd.bos.exception.KDException;
import kd.bos.schedule.executor.AbstractTask;
import kd.sdk.plugin.Plugin;
import kd.wtc.wtbs.common.util.WTCDateUtils;
import kd.wtc.wtte.business.tietask.TieTimingCommonHelper;
import yxk.utils.DateUtil;

import java.util.Date;
import java.util.Map;

/**
 * @author lijiawang
 * @Date 2023/9/12 10:27
 * @Description:每天匹配当月1日到前一天的调度作业;
 */
public class MonthsMatchresultTask extends AbstractTask implements Plugin {
    public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
        Date today = new Date();
        Date expectStartDate = WTCDateUtils.getBeginDayOfMonth(today);
        Date expectEndDate = TieTimingCommonHelper.getPreDateLastTime(today);
        Date zero = DateUtil.getZero(expectEndDate);
        if (expectStartDate.getTime() <= expectEndDate.getTime()) {
            MatchresultTask matchresultTask=new MatchresultTask();
            matchresultTask.startMatchScheduledTask(expectStartDate,zero);
        }
    }


}
